package io.dshubs.feign.fallback;

import io.dshubs.commons.tools.utils.Result;
import io.dshubs.dto.SysTenantDTO;
import io.dshubs.feign.TenantFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: yu
 * @Date: 2021/08/19/9:32
 */
@Slf4j
@Component
public class TenantFeignClientFallbackFactory implements FallbackFactory<TenantFeignClient> {
    @Override
    public TenantFeignClient create(Throwable throwable) {
        log.error("{}", throwable);
        return new TenantFeignClient() {
            @Override
            public Result<List<SysTenantDTO>> getTenantList() {
                return null;
            }

            @Override
            public Result<SysTenantDTO> getTenantByCode(Long tenantCode) {
                return null;
            }
        };
    }
}
